home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
N-P
/
PaintPeeker.cpt
/
PaintPeeker
/
Paint Peeker.bas
< prev
next >
Wrap
BASIC Source File
|
1987-04-22
|
5KB
|
155 lines
00010 Title$="Paint Peeker"
00011 Author$="Lee Willoughby"
00012 Date$="4/22/87"
00020 DIM X%(1),71 X$(719) : X%(0)=576 : X%(1)=720
00030 WINDOW OFF: COORDINATE WINDOW: DEF MOUSE=1
00040 vertical=1: horizontal=2: BoxX=0: BoxY=0
00050 fullscale=1: smallscale=2
00060 ButtonEvent=1: inEditField=2: ActivateWindow=3: CloseWindow=4
00080 UpdateWindow=5: ReturnKey=6: TabKey=7
00090 WINDOW #smallscale,,(4,28)-(244,328),3
00100 widthsmallwindow=WINDOW(2): heightsmallwindow=WINDOW(3)
00110 WINDOW #fullscale,,(248,46)-(508,328),1
00120 GOSUB "Open"
00130 GOSUB "Init Menus": APPLE MENU "About Paint Peeker..."
00140 DIALOG ON: MOUSE ON: MENU ON
00150 ON DIALOG GOSUB "Check Dialog Event"
00160 ON MOUSE GOSUB "Check Mouse Event"
00170 ON MENU GOSUB "MenuEvent"
00180 DO
00190 DialogEvent=DIALOG(0)
00200 MouseEvent=MOUSE(0)
00210 UNTIL Quit=1
00220 "MenuEvent"
00230 MENU: MenuId=MENU(0):IF MenuId=255 THEN GOSUB "About PaintPeeker": RETURN
00240 ItemId = MENU(1)
00250 ON MenuId GOSUB "File", "Windows"
00260 RETURN
00270 "File"
00280 ON ItemId GOSUB "Open", "Quit"
00290 RETURN
00300 "Open"
00310 Boxwidth=5*WINDOW(2)/12 : Boxheight=5*WINDOW(3)/12
00320 CALL SETRECT(boxrect&,0,0,Boxwidth,Boxheight)
00330 GOSUB "Get Paint File"
00340 GOSUB "Make New Box"
00350 WINDOW OUTPUT #smallscale: PICTURE (BoxX,BoxY),Box&
00360 WINDOW OUTPUT #fullscale
00370 RETURN
00380 "Quit": END
00381 "Windows"
00382 ON ItemId GOSUB "SmallScale", "FullScale"
00383 RETURN
00384 "SmallScale"
00385 WINDOW #smallscale
00386 RETURN
00387 "FullScale"
00388 WINDOW #fullscale
00389 RETURN
00399 "Check Dialog Event"
00400 DialogEvent=DIALOG(0)
00410 ON DialogEvent GOSUB "ButtonEvent", "inEditField", "ActivateWindow", "CloseWindow", "UpdateWindow", "ReturnKey", "TabKey"
00420 RETURN
00430 "ButtonEvent"
00440 RETURN
00450 "inEditField"
00460 RETURN
00470 "ActivateWindow"
00480 activate=DIALOG(ActivateWindow)
00490 WINDOW #activate
00500 RETURN
00510 "UpdateWindow"
00520 CURSOR=4
00530 GOSUB "Make New Box": WINDOW OUTPUT#smallscale: PICTURE (BoxX,BoxY),Box&
00540 WINDOW OUTPUT#fullscale
00550 Boxwidth=5*WINDOW(2)/12 : Boxheight=5*WINDOW(3)/12
00552 IF BoxX<0 THEN BoxX=0
00554 IF BoxY<0 THEN BoxY=0
00556 IF (BoxX+Boxwidth+1)>widthsmallwindow THEN BoxX=widthsmallwindow-1-Boxwidth
00558 IF (BoxY+Boxheight+1)>heightsmallwindow THEN BoxY=heightsmallwindow-1-Boxheight
00560 PUT (0-12*BoxX/5,0-12*BoxY/5),X%(0),PSET: REM This puts the PAINT picture
00565 GOSUB "Make New Box": WINDOW OUTPUT#smallscale
00570 IF DIALOG(UpdateWindow)=smallscale THEN PUT (0,0)-(240,300),X%(0),PSET: REM Draw a scaled down version
00580 PICTURE (BoxX,BoxY),Box&
00590 WINDOW OUTPUT#fullscale
00600 CURSOR=0
00610 RETURN
00620 "CloseWindow"
00630 Quit=1
00640 RETURN
00650 "ReturnKey"
00660 RETURN
00670 "TabKey"
00680 RETURN
00690 "Check Mouse Event"
00700 MouseEvent=MOUSE(0)
00710 LONG IF WINDOW(0)=smallscale
00720 mousex%=MOUSE(1):mousey%=MOUSE(2)
00730 CALL SETPT(mousept&,mousex%,mousey%)
00740 WINDOW OUTPUT#1
00750 Boxwidth=5*WINDOW(2)/12 : Boxheight=5*WINDOW(3)/12
00760 CALL SETRECT(boxrect&,BoxX,BoxY,BoxX+Boxheight,BoxY+Boxheight)
00770 WINDOW OUTPUT #2: TEXT,,,0
00780 LONG IF FN PTINRECT(mousept&,boxrect&)
00790 Xdiff=mousex%-BoxX: Ydiff=mousey%-BoxY
00800 GOSUB "Make New Box"
00810 DO
00820 PICTURE (BoxX,BoxY),Box&
00830 BoxX=(MOUSE(1)-Xdiff):BoxY=(MOUSE(2)-Ydiff)
00840 IF BoxX<0 THEN BoxX=0
00850 IF BoxY<0 THEN BoxY=0
00860 IF (BoxX+Boxwidth+1)>widthsmallwindow THEN BoxX=widthsmallwindow-1-Boxwidth
00870 IF (BoxY+Boxheight+1)>heightsmallwindow THEN BoxY=heightsmallwindow-1-Boxheight
00880 WINDOW OUTPUT#fullscale
00890 PUT (0-12*BoxX/5,0-12*BoxY/5),X%(0),PSET: REM This puts the PAINT picture on the screen.
00900 WINDOW OUTPUT#smallscale
00910 PICTURE (BoxX,BoxY),Box&
00920 UNTIL MOUSE(0)=0
00930 END IF
00940 END IF
00950 RETURN
00960 "Get Paint File"
00970 REM This routine will load a MACPAINT file specified by the user
00980 A$=FILES$(1,"PNTG",,V%): IF A$="" THEN RETURN
00990 CURSOR=4: BoxX=0: BoxY=0
01000 OPEN"I",1,A$,1,V% : FL&=LOF(1)-512 : RECORD #1,512
01010 A&=VARPTR(A$) : Y&=VARPTR(X$(0)) : X&=A& : N=256
01020 FOR I=1 TO 720 : REM # of Lines in a MACPAINT Picture
01030 LONG IF N>180
01040 BLOCKMOVE X&,A&,256-N : X&=A&
01050 IF N>FL& THEN NX=FL& ELSE NX=N
01060 READ FILE #1,A&+256-N,NX : FL&=FL&-NX
01070 END IF
01080 CALL UNPACKBITS(X&,Y&,72) : N=X&-A&: REM Puts bit image in memory.
01090 NEXT
01100 CLOSE 1
01110 WINDOW OUTPUT#2
01120 PUT (0,0)-(240,300),X%(0),PSET: REM Draw a scaled down version
01130 WINDOW OUTPUT#1
01140 PUT (0,0),X%(0),PSET: REM This puts the PAINT picture on the screen.
01150 CURSOR=0
01160 REM RETURN if end of subroutine
01170 RETURN
01180 "Make New Box"
01190 CurrentWindow=WINDOW(1): IF CurrentWindow<>fullscale THEN WINDOW OUTPUT#fullscale
01200 PICTURE ON
01210 PEN ,,,10,6
01220 BOX 0,0 TO Boxwidth,Boxheight
01230 PEN ,,,8,0
01240 PICTURE OFF, Box&
01250 IF WINDOW(1)<>CurrentWindow THEN WINDOW OUTPUT#CurrentWindow
01260 RETURN
01270 "Init Menus"
01280 MENU 1,0,1,"File"
01290 MENU 1,1,1,"/OOpen…"
01300 MENU 1,2,1,"/QQuit"
01302 MENU 2,0,1,"Windows"
01304 MENU 2,1,1,"Reduced Scale"
01306 MENU 2,2,1,"Full Scale"
01310 RETURN
01320 "About PaintPeeker"
01330 A&= FN GETNEWDIALOG(31267,0,-1)
01360 CALL MODALDIALOG(0,Item%)
01370 CALL DISPOSDIALOG(A&)
01380 RETURN